package com.atguigu.lease.web.app.custom.config;

import com.atguigu.lease.web.app.custom.interceptor.AuthenticationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * projectName: lease
 *
 * @author: 王玉乾
 * time: 2024/10/12 10:15 周六
 * description:
 */
public class WebMvcConfiguration implements WebMvcConfigurer {
    @Value("${app.auth.path-patterns.include}")
    private String[] include;
    @Value("${app.auth.path-patterns.exclude}")
    private String[] exclude;
    @Autowired
    private AuthenticationInterceptor authenticationInterceptor;



    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(this.authenticationInterceptor).addPathPatterns(include).excludePathPatterns(exclude);    }
}
